package com.spring.springboot.sys.core.config;

import com.spring.springboot.sys.core.interceptor.HeaderInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author 宋义州
 * @description 自定义拦截器注册
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private HeaderInterceptor headerInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 自定义拦截器
        registry.addInterceptor(headerInterceptor).addPathPatterns("/**").order(0);
    }
}
